import axios from 'axios';
import {apiPath} from "./apiPath";

const baseUrl = apiPath.article;

export interface ArticleData {
    id: string;
    title: string;
    description: string;
    titleImage: string;
    createTime: string;
    category: any;
    tags: Array<any>;
}

export interface ArticleDetail{
    categoryId: number;
    categoryName: string;
    content: string;
    readNum: number;
    title: string;
    tags: Array<any>;
    updateTime: string;
    preArticle: any;
    nextArticle: any;
}

export const queryArticleList = async (data: any) => {
    const res = await axios.post(baseUrl.indexList, data);
    return res.data.data;
}

export const queryArticleDetail = async (articleId: number) => {
    const res = await axios.post(baseUrl.detail, {articleId});
    return res.data.data;
};
